<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>预定义常量</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="gearman.resources.html">资源类型</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="gearman.examples.html">范例</a></div>
 <div class="up"><a href="book.gearman.html">Gearman</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="gearman.constants" class="appendix">
 <h1>预定义常量</h1>

 <p class="simpara">下列常量由此扩展定义，且仅在此扩展编译入 PHP 或在运行时动态载入时可用。</p>
 <p class="para">
  Return values.  Always check <span class="methodname"><a href="gearmanclient.error.html" class="methodname">GearmanClient::error()</a></span> or 
  <span class="methodname"><strong>GearmanWorker()</strong></span> for a string error, as it may contain
  more details:
 </p>
 <p class="para">
  <dl>

   
    <dt id="constant.gearman-success">
     <strong><code>GEARMAN_SUCCESS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Whatever action was taken was successful.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-io-wait">
     <strong><code>GEARMAN_IO_WAIT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      When in non-blocking mode, an event is hit that would have blocked.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-errno">
     <strong><code>GEARMAN_ERRNO</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      A system error.  Check <span class="methodname"><strong>GearmanClient::errno()</strong></span> or
      <span class="methodname"><strong>GearmanWorker::errno()</strong></span> for the system error code that
      was returned.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-no-active-fds">
     <strong><code>GEARMAN_NO_ACTIVE_FDS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      <span class="methodname"><strong>GearmanClient::wait()</strong></span> or <span class="methodname"><strong>GearmanWorker()</strong></span> was
      called with no connections.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-unexpected-packet">
     <strong><code>GEARMAN_UNEXPECTED_PACKET</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Indicates something going very wrong in gearmand.  Applies only to
      <a href="class.gearmanworker.html" class="classname">GearmanWorker</a>.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-getaddrinfo">
     <strong><code>GEARMAN_GETADDRINFO</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      DNS resolution failed (invalid host, port, etc).
     </span>
    </dd>

   
   
    <dt id="constant.gearman-no-servers">
     <strong><code>GEARMAN_NO_SERVERS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Did not call <span class="methodname"><a href="gearmanclient.addserver.html" class="methodname">GearmanClient::addServer()</a></span> before submitting jobs
      or tasks.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-lost-connection">
     <strong><code>GEARMAN_LOST_CONNECTION</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Lost a connection during a request.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-memory-allocation-failure">
     <strong><code>GEARMAN_MEMORY_ALLOCATION_FAILURE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Memory allocation failed (ran out of memory).
     </span>
    </dd>

   
   
    <dt id="constant.gearman-server-error">
     <strong><code>GEARMAN_SERVER_ERROR</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Something went wrong in the Gearman server and it could not handle the
      request gracefully.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-work-data">
     <strong><code>GEARMAN_WORK_DATA</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Notice return code obtained with <span class="methodname"><a href="gearmanclient.returncode.html" class="methodname">GearmanClient::returnCode()</a></span>
      when using <span class="methodname"><a href="gearmanclient.do.html" class="methodname">GearmanClient::do()</a></span>.  Sent to update the client
      with data from a running job.  A worker uses this when it needs to send updates,
      send partial results, or flush data during long running jobs.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-work-warning">
     <strong><code>GEARMAN_WORK_WARNING</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Notice return code obtained with <span class="methodname"><a href="gearmanclient.returncode.html" class="methodname">GearmanClient::returnCode()</a></span>
      when using <span class="methodname"><a href="gearmanclient.do.html" class="methodname">GearmanClient::do()</a></span>.  Updates the client with
      a warning.  The behavior is just like <strong><code>GEARMAN_WORK_DATA</code></strong>, but
      should be treated as a warning instead of normal response data.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-work-status">
     <strong><code>GEARMAN_WORK_STATUS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Notice return code obtained with <span class="methodname"><a href="gearmanclient.returncode.html" class="methodname">GearmanClient::returnCode()</a></span>
      when using <span class="methodname"><a href="gearmanclient.do.html" class="methodname">GearmanClient::do()</a></span>. Sent to update the status
      of a long running job. Use <span class="methodname"><a href="gearmanclient.dostatus.html" class="methodname">GearmanClient::doStatus()</a></span> to obtain
      the percentage complete of the task.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-work-exception">
     <strong><code>GEARMAN_WORK_EXCEPTION</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Notice return code obtained with <span class="methodname"><a href="gearmanclient.returncode.html" class="methodname">GearmanClient::returnCode()</a></span>
      when using <span class="methodname"><a href="gearmanclient.do.html" class="methodname">GearmanClient::do()</a></span>. Indicates that a job failed
      with a given exception.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-work-fail">
     <strong><code>GEARMAN_WORK_FAIL</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Notice return code obtained with <span class="methodname"><a href="gearmanclient.returncode.html" class="methodname">GearmanClient::returnCode()</a></span>
      when using <span class="methodname"><a href="gearmanclient.do.html" class="methodname">GearmanClient::do()</a></span>. Indicates that the job failed.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-could-not-connect">
     <strong><code>GEARMAN_COULD_NOT_CONNECT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Failed to connect to servers.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-invalid-function-name">
     <strong><code>GEARMAN_INVALID_FUNCTION_NAME</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Trying to register a function name of NULL or using the callback interface
      without specifying callbacks.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-invalid-worker-function">
     <strong><code>GEARMAN_INVALID_WORKER_FUNCTION</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Trying to register a function with a NULL callback function.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-no-registered-functions">
     <strong><code>GEARMAN_NO_REGISTERED_FUNCTIONS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      When a worker gets a job for a function it did not register.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-no-jobs">
     <strong><code>GEARMAN_NO_JOBS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      For a non-blocking worker, when <span class="methodname"><a href="gearmanworker.work.html" class="methodname">GearmanWorker::work()</a></span> does not have
      any active jobs.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-echo-data-corruption">
     <strong><code>GEARMAN_ECHO_DATA_CORRUPTION</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      After <span class="methodname"><a href="gearmanclient.echo.html" class="methodname">GearmanClient::echo()</a></span> or <span class="methodname"><a href="gearmanworker.echo.html" class="methodname">GearmanWorker::echo()</a></span>
      the data returned doesn&#039;t match the data sent.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-need-workload-fn">
     <strong><code>GEARMAN_NEED_WORKLOAD_FN</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      When the client opted to stream the workload of a task, but did not
      specify a workload callback function.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-pause">
     <strong><code>GEARMAN_PAUSE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      For the non-blocking client task interface, can be returned from the task callback
      to &quot;pause&quot; the call and return from <span class="methodname"><a href="gearmanclient.runtasks.html" class="methodname">GearmanClient::runTasks()</a></span>.
      Call <span class="methodname"><a href="gearmanclient.runtasks.html" class="methodname">GearmanClient::runTasks()</a></span> again to continue.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-unknown-state">
     <strong><code>GEARMAN_UNKNOWN_STATE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Internal client/worker state error.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-send-buffer-too-small">
     <strong><code>GEARMAN_SEND_BUFFER_TOO_SMALL</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Internal error: trying to flush more data in one atomic chunk than is possible
      due to hard-coded buffer sizes.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-timeout">
     <strong><code>GEARMAN_TIMEOUT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Hit the timeout limit set by the client/worker.
     </span>
    </dd>

   
  </dl>

 </p>

 <p class="para">
  <a href="class.gearmanclient.html" class="classname">GearmanClient</a> options:
 </p>
 <p class="para">
  <dl>

   
    <dt id="constant.gearman-client-non-blocking">
     <strong><code>GEARMAN_CLIENT_NON_BLOCKING</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Run the cient in a non-blocking mode.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-client-unbuffered-result">
     <strong><code>GEARMAN_CLIENT_UNBUFFERED_RESULT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Allow the client to read data in chunks rather than have the library
      buffer the entire data result and pass that back.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-client-free-tasks">
     <strong><code>GEARMAN_CLIENT_FREE_TASKS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Automatically free task objects once they are complete.  This is the default
      setting in this extension to prevent memory leaks.
     </span>
    </dd>

   
  </dl>

 </p>

 <p class="para">
  <a href="class.gearmanworker.html" class="classname">GearmanWorker</a> options:
 </p>
 <p class="para">
  <dl>

   
    <dt id="constant.gearman-worker-non-blocking">
     <strong><code>GEARMAN_WORKER_NON_BLOCKING</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Run the worker in non-blocking mode.
     </span>
    </dd>

   
   
    <dt id="constant.gearman-worker-grab-uniq">
     <strong><code>GEARMAN_WORKER_GRAB_UNIQ</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      Return the client assigned unique ID in addition to the job handle.
     </span>
    </dd>

   
  </dl>

 </p>

 <p class="para">
  Base Gearman configuration:
 </p>
 <p class="para">
  <dl>

   
    <dt id="constant.gearman-default-tcp-host">
     <strong><code>GEARMAN_DEFAULT_TCP_HOST</code></strong>
     (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-default-tcp-port">
     <strong><code>GEARMAN_DEFAULT_TCP_PORT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-default-socket-timeout">
     <strong><code>GEARMAN_DEFAULT_SOCKET_TIMEOUT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-default-socket-send-size">
     <strong><code>GEARMAN_DEFAULT_SOCKET_SEND_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-default-socket-recv-size">
     <strong><code>GEARMAN_DEFAULT_SOCKET_RECV_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-max-error-size">
     <strong><code>GEARMAN_MAX_ERROR_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-packet-header-size">
     <strong><code>GEARMAN_PACKET_HEADER_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-job-handle-size">
     <strong><code>GEARMAN_JOB_HANDLE_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-option-size">
     <strong><code>GEARMAN_OPTION_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-unique-size">
     <strong><code>GEARMAN_UNIQUE_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-max-command-args">
     <strong><code>GEARMAN_MAX_COMMAND_ARGS</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-args-buffer-size">
     <strong><code>GEARMAN_ARGS_BUFFER_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-send-buffer-size">
     <strong><code>GEARMAN_SEND_BUFFER_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-recv-buffer-size">
     <strong><code>GEARMAN_RECV_BUFFER_SIZE</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
   
    <dt id="constant.gearman-worker-wait-timeout">
     <strong><code>GEARMAN_WORKER_WAIT_TIMEOUT</code></strong>
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
  </dl>

 </p>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="gearman.resources.html">资源类型</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="gearman.examples.html">范例</a></div>
 <div class="up"><a href="book.gearman.html">Gearman</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
